"""
@Author : 合肥一元数智教育科技有限公司
@Date :  2025/3/3 8:40
@Description :
编写Car类，包含宽、高、重量等属性
1)get_details方法用于返回Car的详细信息
2)编写Roadster子类，继承Car类，添加特有属性【品牌brand】
3)编写Bus子类，继承Car类，添加特有属性【color】
4)完成测试，创建Roadster和Bus对象，分别给对象中特有的属性赋值,以及从Car类继承的属性赋值，
5）使用打印方法print_details输出信息
"""


class Car:
    __width = None
    __height = None
    __weight = None

    def set_width(self, width):
        self.__width = width

    def set_height(self, height):
        self.__height = height

    def set_weight(self, weight):
        self.__weight = weight

    def get_details(self):
        return self.__width, self.__height, self.__weight


class Roadster(Car):
    __brand = None

    def set_brand(self, brand):
        self.__brand = brand

    # def __init__(self, brand):
    #     self.brand = brand

    #  输出详细信息
    def print_details(self):
        width, height, weight = self.get_details()
        return width, height, weight, self.__brand


class Bus(Car):
    __color = None

    def set_color(self, color):
        self.__color = color

    def print_details(self):
        width, height, weight = self.get_details()
        return width, height, weight, self.__color

roadster = Roadster()
roadster.set_width(2)
roadster.set_height(3)
roadster.set_weight(5)
roadster.set_brand('BYD')

print(roadster.get_details())
print(roadster.print_details())


bus = Bus()
bus.set_width(1)
bus.set_height(2)
bus.set_weight(3)
bus.set_color("white")
print(bus.print_details())
